//
//  UIImageView+JKExtension.m
//  01-百思不得姐
//
//  Created by albert on 16/3/28.
//  Copyright (c) 2016年 albert. All rights reserved.
//

#import "UIImageView+JKExtension.h"
#import "UIImageView+WebCache.h"
#import "JKLoginTool.h"

@implementation UIImageView (JKExtension)
/** 设置头像 */
- (void)setHeaderIcon:(NSString *)urlStr{
    
    //设置图片
    [self sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:[JKLoginTool headerIconPlaceHolder] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
        if (image == nil) {
            return;
        }
        
        dispatch_async(dispatch_get_global_queue(0, 0), ^{
            
            UIImage *img = [image circleImage];
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                self.image = img;
            });
        });
    }];
}
@end
